
<template>
  <div class="execution">
    <basic-container>
      <avue-crud
        :page.sync="page"
        :permission="permissionList"
         v-bind="bindVal"
         v-on="onEvent"
      >
        <template slot="menuLeft">
          <el-button type="primary" size="small" @click="delBatch">删除</el-button>
        </template>
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>
import baseCrud from '@/mixins/base-crud'
import {
  delsObj
} from "@/api/admin/sysuserinfochange";
import { mapGetters } from "vuex";

export default {
  name: "sysuserinfochange",
  mixins: [baseCrud('admin/sysuserinfochange')],
  data() {
    return {
    };
  },
  computed: {
    ...mapGetters(["permissions"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permissions.sys_userinfochange_add, false),
        delBtn: this.vaildData(this.permissions.sys_userinfochange_del, false),
        editBtn: this.vaildData(this.permissions.sys_userinfochange_edit, false)
      };
    }
  },
  methods: {
    delBatch: function() {
      if (this.$refs.crud.tableSelect.length < 1) {
        this.$message.error("请选择数据");
        return false;
      }
      let ids = [];
      for (const table of this.$refs.crud.tableSelect) {
        ids.push(table.id);
      }
      this.$confirm("确认删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        delsObj(ids)
          .then(data => {
            this.$message.success("删除成功");
            this.getList(this.page);
            done();
          })
          .catch(() => {
            loading();
          });
      });
    },
  }
};
</script>
